package com.xjtu.platform.security.updateInfo.dao;

import com.xjtu.platform.security.updateInfo.UpdateInfoDto;
import com.xjtu.platform.security.updateInfo.User;
import com.xjtu.platform.security.updateInfo.UserDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UpdateInfoDao {
    @Update("update user set age=#{dto.user_age}, phone=#{dto.user_phone}, email=#{dto.email}, user_name=#{dto.user_name} where user_id=#{user_id}")
    void updateInfo(@Param("dto") UpdateInfoDto updateInfoDto,@Param("user_id") String user_id);

    @Select("select user_name,age,phone,email from user where user_id=#{user_id}")
    List<User> getUserInfo(@Param("dto") UserDto dto,@Param("user_id") String user_id);

    @Select("select flag from user where user_id=#{user_id}")
    int getFlag(String user_id);

    @Select("select time from cache where cache_id=#{user_id}")
    long getCachetime(String user_id);
}
